//format方法
Date.prototype.Format = function (fmt) {  
  var o = {
      "M+": this.getMonth() + 1, //月份 
      "d+": this.getDate(), //日 
      "h+": this.getHours(), //小时 
      "m+": this.getMinutes(), //分 
      "s+": this.getSeconds(), //秒 
      "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
      "S": this.getMilliseconds() //毫秒 
  };
  if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  for (var k in o)
  if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
  return fmt;
}


//获取当前月第一天
// 获取当前月的第一天 例如 2022-04-01 00:00:00
export const currmonthStarttime = () => {
  let today = new Date();  //中国标准时间 当前时间
  // 设置一个月的某一天
  today.setDate(1)
  let oYear = today.getFullYear();
  let oMoth = (today.getMonth() + 1).toString();
  if (oMoth.length <= 1) oMoth = "0" + oMoth;
  let oDay = today.getDate().toString();
  if (oDay.length <= 1) oDay = "0" + oDay;

  return oYear + "-" + oMoth + "-" + oDay + " " + '00' + ":" + '00' + ":" + '00';
}
